-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Legg til displayAttribute til SearchableDropdown og AccountSelector #2583
Conversation
makes it possible to override what is displayed in the SearchableDropdown input previous default was the first attribute in the searchAttribute prop. The same should be the case with this change
02ca829
to
901ec32
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Skal bare kjøre opp lokalt så kommer approve :)
packages/ffe-account-selector-react/src/account-selector/AccountSelector.stories.tsx
Outdated
Show resolved
Hide resolved
packages/ffe-account-selector-react/src/account-selector/AccountSelector.stories.tsx
Outdated
Show resolved
Hide resolved
packages/ffe-account-selector-react/src/account-selector/AccountSelector.stories.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fjern gjerne consol loggene
Ellers helt nydelig PR. Gode navn, ryddig, perf commits 👨🍳 🫰
makes it possible to override what is displayed in the AccountSelector input. So you can have a new custom attribute in the input, example a new attribute that contains: account_name - account_number previous default was the first attribute in the searchAttribute prop. The same should be the case with this change. Needed to add the displayAttribute to the searchAttributes passed to the SearchableDropdown, so the user don't see a message about 0 hits when changing the input.
901ec32
to
c1baf20
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sånn, vet ikke hvorfor forrige ikke ble en approve 😄
Ah, du var på ja 👏
Beskrivelse
Legger til en prop kalt
displayAttribute
iSearchableDropdown
ogAccountSelector
.Denne propen lar deg overstyre hvilket element i objektene sendt inn (
Item/T extends Account
) som er brukt til visning i input elementet.Defaulten før var det første elementet i
searchAttributes
(ble navn), det er fortsatt samme defaultDisse endringene burde ikke har noe å si for eksisterende bruk, kun for nye.
Viktig å få med seg endringen i
AccountSelector
på søk. Jeg ble nød til å legge til den nyedisplayAttribute
propen tilsearchAttributes
sendt videre tilSearchableDropdown
komponenten, for å ikke få "Ingen konto funnet" når man prøver å endre inputen etter det er valgt et element.Skjermbilde på

SearchableDropdown
:Skjermbilde på

AccountSelector
:Lagt inn ny story i StoryBook-en til
AccountSelector
for å vise bruk.Også lagt til nye tester på begge komponenter som verifiserer at dette funker.
Motivasjon og kontekst
Vi i team sparing ønsker å vise mer enn bare konto navn på Spareoversikt konto velgeren. Er flere brukere som har samme navn på flere kontoer. Vi ønsker at det skal vises slik i
AccountSelector-en
: "Kontonavn - Kontonummer"Se skjermbilde

Men vi ønsker ikke å bytte navn på kontoene i nedtrekksmenyen.
Så dette viser seg å være vanskelig med dagens løsning.
Disse endringene gjør det mulig å få til det som er ønsket
Testing
Lagt til jest tester
Lagt inn nye stories i StoryBook-en som viser bruk og eksempler